<!DOCTYPE html>
<html>
<head>
    <title>DAE 求解器</title>
    <style>
        body { font-family: Arial; max-width: 800px; margin: 0 auto; padding: 20px; }
        textarea { width: 100%; height: 150px; padding: 10px; }
        button { padding: 10px 20px; background: #4CAF50; color: white; border: none; }
        button:disabled { background: #cccccc; }
        .alert { padding: 15px; margin: 20px 0; border-radius: 4px; }
        .alert-warning { background: #fff3cd; color: #856404; }
        .alert-error { background: #f8d7da; color: #721c24; }
    </style>
</head>
<body>
    <h1>DAE 方程组求解器</h1>

    {% if messages %}
        {% for message in messages %}
            <div class="alert alert-{{ message.tags }}">{{ message }}</div>
        {% endfor %}
    {% endif %}

    <form method="post" action="{% url 'myweb:start_solving' %}">
        {% csrf_token %}
        <label>输入方程组（每行一个方程）：</label><br>
        <p>示例:(x'' = -2x + y + sin(t)
y'' = x - 2y + cos(t)
x(0) = 0, x'(0) = 1
y(0) = 1, y'(0) = 0)</p>
        <textarea name="equations" required></textarea><br>

        <label>时间范围 t ∈ [0,
            <input type="number" name="t_max" value="5.0" step="0.1" min="0.1" required>]
        </label><br><br>

        {% if not request.session.is_processing %}
            <button type="submit">开始求解</button>
        {% else %}
            <button type="button" disabled>计算中，请稍候...</button>
        {% endif %}
    </form>
</body>
</html>